<template>
	<view class="box">
		<!-- #ifdef MP-WEIXIN -->
		<view class="head"
			:style="'padding-top:'+statusBarHeight1+'px;height:' + (statusBarHeight1 + 44) + 'px'">
			<!-- :style="'padding-top:'+statusBarHeight1+'px;padding-right:'+ (WXwidth + 15) +'px;height:' + (statusBarHeight1 + 44) + 'px'"> -->
			<!-- #endif -->
			<!-- #ifndef MP-WEIXIN -->
			<view class="head"
				:style="'padding-top:'+(statusBarHeight1+10)+'px;height:' + (statusBarHeight1 + 54) + 'px'">
				<!-- #endif -->
				<image class="fanhui" @click="fanhui" src="https://pic.bangbangtongcheng.com/static/fanhui_bai.png" mode=""></image>
				<view class="biaoti">
					屏蔽名单
				</view>
				<view class="fanhui"></view>
			</view>
			<!-- #ifdef MP-WEIXIN -->
			<view :style="'padding-top:'+statusBarHeight1+'px;height:' + (statusBarHeight1 + 44) + 'px'"></view>
			<!-- #endif -->
			<!-- #ifndef MP-WEIXIN -->
			<view :style="'padding-top:'+statusBarHeight1+'px;height:' + (statusBarHeight1 + 54) + 'px'"></view>
			<!-- #endif -->
			<scroll-view scroll-y="true" class="list" :style="'height: calc(100vh - '+ curTop + 'px );'">
				<view class="center">
					<view class="item" v-for="(item,index) in data" :key="item.id">
						<view class="title">
							{{item.associationName}}
						</view>
						<view class="remove" @click="getRemove(item.id)">
							移除
						</view>
					</view>
				</view>
				<view v-if="data.length == 0" class="none">
					<image src="https://pic.bangbangtongcheng.com/static/none.png" mode="widthFix" />
					<view>没有更多数据了</view>
				</view>
			</scroll-view>
			<uniBall></uniBall>
		</view>
</template>
<script>
	import permision from "@/js_sdk/wa-permission/permission.js"
	//#ifdef H5
	import wxshare from "@/utils/index.js";
	//#endif
	import {
		mapGetters
	} from "vuex";
	export default {
		data() {
			return {
				userInfo: uni.getStorageSync("Pduser"),
				WXwidth: "",
				text:'管理',
				value:'',
				curTop:300,
				data:[],
			};
		},
		onLoad(options) {
			var than = this;
			// #ifdef MP-WEIXIN
			// 获取胶囊信息
			let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
			let getWindowInfo = uni.getWindowInfo().screenWidth
			this.WXwidth = getWindowInfo - (menuButtonInfo.right - menuButtonInfo.width)
			// #endif
			this.getData()
			/* #ifdef H5 */
			this.jinzhi();
			/* #endif */
		},
		mounted() {
			let that = this
			this.$nextTick(function() {
				uni.createSelectorQuery().in(this).select('.list').boundingClientRect(result => {
					if (result) {
						that.curTop = result.top
					}
				}).exec();
			})
		},
		methods: {
			getData() {
				let that = this;
				this.$myRequest.get("/api/mobile/personnelOwner/getShieldBlock", {
					userId: this.userInfo.id,
				}).then(res => {
					this.data = res.shieldBlock.pageList
				});
			},
			getRemove(id){
				let that = this;
				this.$myRequest.post("/api/mobile/personnelOwner/removeShieldBlock", {
					ids: id,
				}).then(res => {
					uni.showToast({
						title: res.msg,
						icon: "none",
						mask: true
					});
					setTimeout(()=>{
						this.getData()
					},500)
				});
			},
			jinzhi() {
				let _this = this;
				let param = window.location.href.split("#")[0];
				uni.request({
					method: "post",
					data: {
						url: param
					},
					header: {
						"content-type": "application/x-www-form-urlencoded"
					},
					url: "https://www.bangbangtongcheng.com/conven//mob/login/getJsTicket.do",
					success(re) {
						_this.jinzhifx(re.data);
					}
				});
			},
			jinzhifx(data) {
				wxshare.config({
					debug: false, //是否打开调试
					appId: data.appId, // 公众号的唯一标识
					timestamp: data.timestamp, // 生成签名的时间戳
					nonceStr: data.nonce, // ，生成签名的随机串
					signature: data.signature, // 签名
					jsApiList: ["hideMenuItems"]
				});
				// 禁止分享
				wxshare.hideMenuItems({
					// 要隐藏的菜单项，只能隐藏“传播类”和“保护类”按钮，所有menu项见附录3
					menuList: [
						"menuItem:share:appMessage",
						"menuItem:share:timeline",
						"menuItem:share:timeline",
						"menuItem:share:qq",
						"menuItem:favorite",
						"menuItem:share:QZone",
						"menuItem:openWithSafari"
					]
				});
			},
			fanhui() {
				uni.navigateBack({
					delta: 1
				});
			},
		},
		computed: {
			...mapGetters(["userid", "islogin", "statusBarHeight1", "userinfo"])
		}
	};
</script>
<style lang="less" scoped>
	.box {
		width: 100%;
		min-height: 100vh;
		background-color: #fff;
	}

	.head {
		position: fixed;
		top: 0;
		left: 0;
		width: 750rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 15px;
		background-color: #64B6A8;
		z-index: 1000;
		color: #fff;
		.biaoti{
			font-size: 36rpx;
			font-weight: 500;
		}
		.fanhui {
			width: 40rpx;
			height: 40rpx;
		}
	}
	.center{
		.item{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 45rpx 45rpx 35rpx 45rpx;
			border-bottom: 1px solid #E0E0E0;
			.title{
				width: 60%;
				font-size: 34rpx;
				font-weight: 400;
				color: #333333;
				-webkit-line-clamp: 2;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				overflow: hidden;
				text-overflow: ellipsis;
			}
			.remove{
				width: 136rpx;
				height: 54rpx;
				border-radius: 8rpx;
				border: 1px solid #64B6A8;
				font-size: 24rpx;
				font-weight: 400;
				color: #64B6A8;
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
	}
	.none {
		text-align: center;
	
		image {
			width: 430rpx;
			margin-bottom: 16rpx;
		}
	
		.img1 {
			background-color: #f8f8f8;
			width: 300rpx;
			height: 200rpx;
		}
	
		.img2 {
			position: absolute;
			width: 300rpx;
			height: 200rpx;
		}
	
		.img3 {
			position: absolute;
			width: 300rpx;
			height: 200rpx;
		}
	
		view {
			height: 40rpx;
			line-height: 40rpx;
			color: #666;
		}
	}
</style>
